import cartRender from "./cartRender.js";
import loaddata from "./loaddata.js";
import dataManipulation from "./dataManipulation.js";
export default function(){
    // console.log($(".login_id"))
    var ls = localStorage.getItem("user");
    if(ls !== null){
        var la = JSON.parse(ls);
        var html = "";
        $.each(la,function(index,item){
            html = `ip${item.user_phone}`;
        })
        $(".login_id").html(html);
        $(".login_id").on("click",$.proxy(function(){
            if(window.confirm("是否退出登录")){
                $(".login_id").html("登录");
                $(".login_id").removeAttr("href");
            }
        },this));
        // $(".login_id").attr("href","http://localhost/VSCode/JuanPi_web_project/src/login.html");
    }
    loaddata()
    .done(function(res){
        var cart_detail_list = $(".cart-detail-list");
        var html = cartRender().init(res);
        $(cart_detail_list).html(html);
        dataManipulation().init();
    })
}